<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c"  uri="/c.tld" %>
<%@ taglib prefix="fmt"  uri="/fmt.tld" %>
<%@ taglib prefix="fn" uri="/fn.tld" %> 
<%@ page import="com.stone.para.IConstant"%>
<HTML>
<%
	String contextPath = request.getContextPath();
%>
<HEAD>
<title><%=IConstant.PROGRAEM_TITLE%></title>
<link href="<%=contextPath%>/css/css2.css" rel="stylesheet" type="text/css" />
		<style>
			.loginKey{ 
			    background-image:url("<%=contextPath%>/images/key.png") !important; 			
			    background-repeat:no-repeat; 
			    background-position:left; 
			    padding-left:18px;
		    }  
		    
            .loginUser{ 
			    background-image:url("<%=contextPath%>/images/user_suit.png") !important; 	
			    background-repeat:no-repeat; 
			    background-position:left; 
			    padding-left:18px;
		    }  
		</style>
		<script type="text/javascript">
			if(window!=top){
				top.location=window.location;
			}
			function first(){
				document.loginForm.loginId.focus();
			}
			function CheckKeyCodeLogin(){
				var keyCode = event.keyCode;
				if(keyCode==13){
					doOK();
					event.keyCode = null;
				}
			}
			
			function doReset() {
				var oForm=document.loginForm;
				oForm.loginId.options[0].selected = true;
				oForm.password.value = "";
			}
			function doOK(){
				var oForm=document.loginForm;
				if(oForm.loginId.value==""){
					alert("需要填写登录ID！");
					oForm.loginId.focus();
					return false;
				}
				
				var cookieMessage = document.cookie;
				var flag = "0";
				if (cookieMessage != null) {
					var val = cookieMessage.split(";");
					for (var i=0;i<val.length;i++){
						if (val[i].indexOf("cookieUserName") != -1) {
							var val2 = val[i].split("=");
							if (document.forms[0].elements["loginId"].value == val2[1]) {
								flag = "1";
								break;
							}
						}
					}
				}

				if (flag == "0") {
					var dt = new Date();
					dt.setDate(dt.getYear() +1);
					document.cookie ="cookieUserName=" + document.forms[0].elements["loginId"].value+";expires="+dt.toGMTString();
				}
		
				oForm.submit();
			}

		/* cookies取得用户名，从下拉框选择cook的用户*/
		function setUserID() {
			var cookieMessage = document.cookie;
			if (cookieMessage != null) {
				var val = cookieMessage.split(";");
				for (var i=0;i<val.length;i++){
					if (val[i].indexOf("cookieUserName") != -1) {
						var val2 = val[i].split("=");
						
						var userSelect =  document.getElementById("loginId");
						
						for(var j=0;j< userSelect.options.length;j++){
							if (val2[1] == userSelect.options[j].value){
								userSelect.options[j].selected = true;
								break;
							}
						}
					}
				}
			}
			
			document.loginForm.password.focus();

		}
			
		</script>
 
<script type="text/javascript">
	window.innerWidth = screen.width; 
	window.innerHeight = screen.height; 
	window.screenX = 0; 
	window.screenY = 0; 
	alwaysLowered = false; 
</script>

</HEAD>


<body onload="javascript:setUserID()">
   <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" align="center" >
	<tr>
	<td width="100%" height="100%" align="center" valign="middle"  border="0">	
	  	  
	  <table width="1003" height="599" cellpadding="0" cellspacing="0" border="0"  style="background:url(<%=contextPath%>/images/login001.png) no-repeat right">
		<tr>
		  <td width="35%" height="239" align="left" valign="middle"  border="0">&nbsp;</td>
		  <td width="46%"  align="center" valign="middle"  border="0">&nbsp;</td> 
		  <td width="19%"  align="center" valign="middle"  border="0">&nbsp;</td>   
		</tr>
		<tr>
			<td width="35%" height="150"  align="center" valign="middle"  border="0"></td>
			<td width="46%"  align="left" valign="top"  border="0">
			<table width="70%" border="0">
              <tr>
                <td width="100%" align="left" valign="top">
                <form name="loginForm" action="login!login.do" method="post" onKeyPress="javascript:CheckKeyCodeLogin();">
                    <TABLE height=137 cellSpacing=0 cellPadding=0 width="100%" border=0>  
                      <tr height="48"><td colspan="2">&nbsp;</td></tr>   
                      <TR>
                        <td width="37%"></td>
                        <TD width="61%">
                          <INPUT type="loginId"  style="WIDTH:150px" name="loginId" >
                        </TD>
                      </TR>
                      <tr height="28">
                      	<td>&nbsp;</td>
                      </tr>
                      <TR>
                        <td></td>
                        <TD><INPUT type="password" class="loginKey" style="WIDTH:150px" name="password" ></TD>
                      </TR>
                      <c:if test="${!empty err}">
                      	<TR>
                      		<TD width="37%" align=right>
                      			<font color='red'>信息提示：</font>
                        	<TD align=left>
								<font color='red' id="errorMsg">${err}</font>
							</TD>
                      	</TR>
                      </c:if>
                      <c:if test="${empty err}">
                    	 <tr>
                      		<td colspan="2">&nbsp;</td>
                      	</tr>
                      </c:if>
                      
                      <TR>
                        <TD align=right height=44>&nbsp;</TD>
                        <TD><INPUT name="button" type=button style="width:75;height:27;background:url(<%=contextPath%>/images/dl.gif);border:none" onClick="javascript:doOK();" >
                          &nbsp;
                          <LABEL>
                            <INPUT name="button" type=button style="width:75;height:27;background:url(<%=contextPath%>/images/qx.gif);border:none" onClick="javascript:doReset();">
                          </LABEL></TD>
                      </TR>
                    </TABLE>
                </form>
                </td>
              </tr>
          </table>
          </td> 
		  
		  <td width="19%"  align="center" valign="middle"  border="0">&nbsp;</td>     
		</tr>
		<tr>
		  <td width="35%" height="160" align="center" valign="middle"  border="0"></td>
		  <td width="46%"  align="center" valign="middle"  border="0">&nbsp;</td>
		  <td width="19%"  align="left" valign="top"  border="0">&nbsp;</td>   
		</tr>
	</table>
	  </td>
		</tr>
	</table>
</body>
</html>